Skip to content

router: inherit upstream connection filter state in upstream request stream info#10458

Merged
ggreenway merged 18 commits intoenvoyproxy:masterfrom
snowp:upstream-filter-state
Apr 17, 2020
Merged

router: inherit upstream connection filter state in upstream request stream info#10458
ggreenway merged 18 commits intoenvoyproxy:masterfrom
snowp:upstream-filter-state

Conversation

@snowp
Copy link
Copy Markdown
Contributor

@snowp snowp commented Mar 19, 2020

This adds the upstream connection filter state to the upstream request stream info, making it possible to look up upstream connection state from upstream HTTP access logs.

Risk Level: Low
Testing: UT
Docs Changes: n/a
Release Notes: n/a
Fixes #10457

Snow Pettersen added 2 commits March 19, 2020 13:26
…r state

Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
@snowp snowp requested a review from lizan as a code owner March 19, 2020 20:33
Snow Pettersen added 2 commits March 19, 2020 13:58
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
*/
virtual const FilterStateSharedPtr& filterState() PURE;
virtual const FilterState& filterState() const PURE;
virtual const FilterStateSharedPtr& filterState() const PURE;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is a bit unfortunate; it's to make it possible to get the parent FilterStateSharedPtr from a const handle. Open for suggestions here for how to do this better

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have a const-cast somewhere; this looks on the surface like it is const-safe, but the returned ptr is non-const, even though the method is const.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think I would make onPoolReady() pass a non-const StreamInfo. I think it's reasonable for that function to have non-const access to the StreamInfo.

Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
*/
virtual const FilterStateSharedPtr& filterState() PURE;
virtual const FilterState& filterState() const PURE;
virtual const FilterStateSharedPtr& filterState() const PURE;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have a const-cast somewhere; this looks on the surface like it is const-safe, but the returned ptr is non-const, even though the method is const.

*/
virtual const FilterStateSharedPtr& filterState() PURE;
virtual const FilterState& filterState() const PURE;
virtual const FilterStateSharedPtr& filterState() const PURE;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think I would make onPoolReady() pass a non-const StreamInfo. I think it's reasonable for that function to have non-const access to the StreamInfo.

bool filter_state_verified = false;
router_.config().upstream_logs_.push_back(
std::make_shared<TestAccessLog>([&](const auto& stream_info) {
filter_state_verified = stream_info.upstreamFilterState()->hasDataWithName("foo");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would slightly increase readability if the string was "upstream data" or similar.

@ggreenway
Copy link
Copy Markdown
Member

/wait

@stale
Copy link
Copy Markdown

stale bot commented Mar 27, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Mar 27, 2020
@snowp snowp removed the stale stalebot believes this issue/PR has not been touched recently label Mar 30, 2020
Snow Pettersen added 2 commits March 30, 2020 09:48
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>

for (const auto& key : config.filter_state_objects_to_log()) {
if (stream_info.filterState().hasDataWithName(key)) {
if (stream_info.filterState()->hasDataWithName(key)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears #9845 added this ambiguity causing the windows CI compilation failures, not yet quite sure why MSVC is able to resolve it here: https://github.com/envoyproxy/envoy/pull/9845/files#diff-a5570d8b9053a47a1547728cb6c90989 and not this case

Snow Pettersen added 2 commits March 31, 2020 10:40
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Apr 1, 2020

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🔨 rebuilding ci/circleci: coverage (failed build)

🐱

Caused by: a #10458 (comment) was created by @snowp.

see: more, trace.

@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Apr 2, 2020

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s), but failed to run 2 pipeline(s).

Snow Pettersen added 2 commits April 2, 2020 12:42
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
@ggreenway
Copy link
Copy Markdown
Member

CI is unhappy :(

/wait

Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Apr 7, 2020

Seems to be OOMing in CI, merging again to pick up #10669

Snow Pettersen added 3 commits April 8, 2020 16:14
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Apr 17, 2020

@ggreenway I think this can be reviewed now, the failing PR run seems to be due to general OS X issues in CI

Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ggreenway ggreenway merged commit 582ab4a into envoyproxy:master Apr 17, 2020
penguingao pushed a commit to penguingao/envoy that referenced this pull request Apr 22, 2020
…stream info (envoyproxy#10458)

Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: pengg <pengg@google.com>
snowp pushed a commit that referenced this pull request Mar 24, 2021
…ream info (#15543)

This makes it possible to lookup upstream connection filter state from a downstream HTTP
access log, similar to #10458 which does the same for upstream HTTP access logs.

Signed-off-by: Elisha Ziskind <eziskind@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upstream FilterState for HTTP requests

3 participants